home *** CD-ROM | disk | FTP | other *** search
/ Aminet 49 / Aminet 49 (2002)(GTI - Schatztruhe)[!][Jun 2002].iso / Aminet / dev / misc / FlexCat.lha / Lib / AutoC_c.sd < prev    next >
Text File  |  1999-11-28  |  3KB  |  123 lines

  1. ##rem $Id: AutoC_c.sd,v 1.2 1999/11/28 03:36:41 carlos Exp $
  2. ##stringtype C
  3. ##shortstrings
  4. /****************************************************************
  5.  
  6.    This file was created automatically by `%fv'
  7.    from "%f0".
  8.  
  9.    Do NOT edit by hand!
  10.  
  11. ****************************************************************/
  12.  
  13. /****************************************************************
  14.     This file uses the auto initialization possibilities of
  15.     Dice, gcc and SAS/C, respectively.
  16.  
  17.     Dice does this by using the keywords __autoinit and
  18.     __autoexit, SAS uses names beginning with _STI or
  19.     _STD, respectively. gcc uses the asm() instruction,
  20.     to emulate C++ constructors and destructors.
  21.  
  22.     Using this file you don't have *all* possibilities of
  23.     the locale.library. (No Locale or Language arguments are
  24.     supported when opening the catalog. However, these are
  25.     *very* rarely used, so this should be sufficient for most
  26.     applications.
  27.  
  28.     If you really need all possibilities or you have another
  29.     compiler, you should use the source description C_c_V21.sd
  30.     instead.
  31. ****************************************************************/
  32.  
  33.  
  34. /*
  35.     Include files and compiler specific stuff
  36. */
  37. #include <libraries/locale.h>
  38.  
  39. #if defined(__SASC)  ||  defined(_DCC)
  40. #include <proto/exec.h>
  41. #include <proto/locale.h>
  42. typedef struct Library LocaleBase_t;
  43. #elif defined(__GNUC__)
  44. #include <inline/exec.h>
  45. #include <inline/locale.h>
  46. typedef struct LocaleBase LocaleBase_t;
  47. #else
  48. #error "Don't know how to handle your compiler."
  49. #endif
  50.  
  51. #if defined(__SASC) || defined(__GNUC__)
  52. #define __autoinit
  53. #define __autoexit
  54. #endif
  55.  
  56.  
  57. /*
  58.     Variables
  59. */
  60. struct FC_Type
  61. {   LONG   ID;
  62.     STRPTR Str;
  63. };
  64. const struct FC_Type _%i = { %d, (STRPTR) %s };
  65.  
  66. static struct Catalog *%b_Catalog = NULL;
  67.  
  68. LocaleBase_t *LocaleBase;
  69.  
  70.  
  71.  
  72.  
  73.  
  74. STATIC __autoinit VOID _STIOpenCatalog(VOID)
  75.  
  76.   {
  77.     STATIC const struct TagItem tags[] =
  78.       {
  79.     { OC_BuiltInLanguage, (ULONG) %l },
  80.     { OC_Version, %v },
  81.     { TAG_DONE, 0 }
  82.       };
  83.     if ((LocaleBase = (LocaleBase_t *)
  84.               OpenLibrary((STRPTR) "locale.library", 38)))
  85.     {
  86.       %b_Catalog = OpenCatalogA(NULL, (STRPTR) "%b.catalog",
  87.                 (struct TagItem *) tags);
  88.     }
  89.   }
  90.  
  91.  
  92.  
  93. STATIC __autoexit VOID _STDCloseCatalog(VOID)
  94.  
  95.   {
  96.     if (LocaleBase)
  97.       {
  98.     CloseCatalog(%b_Catalog);
  99.     %b_Catalog = NULL;
  100.     CloseLibrary((struct Library *) LocaleBase);
  101.       }
  102.   }
  103.  
  104.  
  105.  
  106. STRPTR GetString(struct FC_Type *fcstr)
  107.  
  108.   {
  109.     STRPTR defaultstr;
  110.     LONG strnum;
  111.  
  112.     strnum = fcstr->ID;
  113.     defaultstr = fcstr->Str;
  114.  
  115.     return(%b_Catalog ? GetCatalogStr(%b_Catalog, strnum, defaultstr) :
  116.             defaultstr);
  117.   }
  118.  
  119. #if defined(__GNUC__)
  120. asm ("  .text;  .stabs \\\"___CTOR_LIST__\\\",22,0,0,__STIOpenCatalog");
  121. asm ("  .text;  .stabs \\\"___DTOR_LIST__\\\",22,0,0,__STDCloseCatalog");
  122. #endif
  123.